package com.kgc.server.service.impl;

import com.kgc.server.dao.AddressDao;
import com.kgc.server.pojo.Address;
import com.kgc.server.service.AddressService;
import com.kgc.server.util.ResponseMessage;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class AddressServiceImpl implements AddressService {

    private Logger logger = LoggerFactory.getLogger(getClass());

    @Autowired
    private AddressDao addressDao;

    @Override
    public ResponseMessage selectDefaultAddress(String userId) {
        logger.info("AddressServiceImpl selectDefaultAddress params: userId"+userId);
        ResponseMessage msg = new ResponseMessage();
        Address address = addressDao.selectDefaultAddress(userId);
        logger.info("AddressServiceImpl selectDefaultAddress params: userId"+userId+";result:"+address);
        msg.setData(address);
        msg.setCode("200");
        msg.setMsg("查询成功");
        return msg;
    }
}
